Skip to content

Fix libjpeg-turbo shared lib build: force PIC for bundled zlib/spng - #80

Merged
wongcht merged 2 commits into
masterfrom
fix/libjpeg-turbo-pic
Jul 31, 2026
Merged

wongcht merged 2 commits into
masterfrom
fix/libjpeg-turbo-pic

Conversation

@wongcht

@wongcht wongcht commented Jul 31, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Bumps LIBJPEG_TURBO_VERSION 3.1.4 → 3.2.0 (supersedes renovate's #66, which will auto-close once this merges).
  • libjpeg-turbo 3.2.0 bundles a vendored zlib/spng (for embedded PNG support) as CMake OBJECT libraries, which are reused by both the static and shared turbojpeg targets.
  • CMake does not automatically apply -fPIC to OBJECT library targets shared between static and shared consumers, so linking libturbojpeg.so failed with relocation R_X86_64_32 against '.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC — see failing run from Update dependency libjpeg-turbo/libjpeg-turbo to v3.2.0 #66.
  • Adds -DCMAKE_POSITION_INDEPENDENT_CODE=ON to the libjpeg-turbo cmake invocation to force PIC on all objects, fixing the shared-lib link so the 3.2.0 upgrade can build.

Test plan

  • CI build passes for dockerfiles/Dockerfile (amd64) with libjpeg-turbo 3.2.0

🤖 Generated with Claude Code

wongcht and others added 2 commits July 31, 2026 22:42
libjpeg-turbo 3.2.0 bundles a vendored zlib/spng as CMake OBJECT
libraries used by both turbojpeg-static and the shared turbojpeg
target. CMake does not auto-apply -fPIC to OBJECT libraries reused
across static and shared targets, causing linking of libturbojpeg.so
to fail with "relocation R_X86_64_32 ... recompile with -fPIC".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@wongcht
wongcht merged commit 9965806 into master Jul 31, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant